Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build static binary on linux #1862

Closed
wants to merge 1 commit into from
Closed

Conversation

bemyak
Copy link
Contributor

@bemyak bemyak commented May 16, 2022

IMPORTANT: Please do not create a Pull Request adding a new feature without discussing it first.

The place to discuss new features is the forum: https://zola.discourse.group/
If you want to add a new feature, please open a thread there first in the feature requests section.

Sanity check:

  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?

Code changes

(Delete or ignore this section for documentation changes)

  • Are you doing the PR on the next branch?

If the change is a new feature or adding to/changing an existing one:

  • Have you created/updated the relevant documentation page(s)?

@bemyak bemyak changed the title Static bin Build static binary on linux May 16, 2022
rustup_toolchain: stable
target: 'x86_64-unknown-linux-gnu'
target: 'x86_64-unknown-linux-musl'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that would break all the package managers, if you want to add musl, it needs to be another target, not replace the existing one.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why would it? All the distros compile it themselves, IMO the only use case for a pre-compiled binary is downloading it to some arbitrary system, which we can't make any assumptions about. So it seems to me that for Linux we should ship only static binaries.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All the distros compile it themselves, IMO the only use case for a pre-compiled binary is downloading it to some arbitrary system, which we can't make any assumptions about

I would rather have both options than only one

So it seems to me that for Linux we should ship only static binaries.

Last time I checked musl, performance was significantly worse. It might have been fixed since then but my results were kinda similar to https://andygrove.io/2020/05/why-musl-extremely-slow/

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for pointing this out, I didn't know. I'll close this PR then.

pool:
vmImage: $(imageName)
steps:
- script: |
curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain $RUSTUP_TOOLCHAIN
echo "##vso[task.setvariable variable=PATH;]$PATH:$HOME/.cargo/bin"
displayName: Install rust
condition: ne( variables['Agent.OS'], 'Windows_NT' )
condition: eq( variables['Agent.OS'], 'Darwin' )
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For Linux the official rust:alpine image is used, which has all the needed stuff installed. So the only target that needs explicit toolchain installation is Darwin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants